package com.yang.webapi.module.controller;

import com.yang.service.model.dto.post.OderPostDTO;
import com.yang.service.model.vo.OderVO;
import com.yang.webapi.module.service.OderWebService;
import com.zhy.base.webapi.annoation.ResponseFormatter;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Xin7K
 * Date: 2019/12/27 0027
 */
@RestController
@ResponseFormatter
@RequestMapping(value = "oder")
@CrossOrigin
@Slf4j
@Api(tags = "订单管理", description = "OderController")
public class OderController {
    @Autowired
    OderWebService oderWebService;

    @ApiOperation("批量下单")
    @PostMapping(value = "add")
    public boolean addNewOder(List<OderPostDTO> dtos){
        return oderWebService.addNewOder(dtos);
    }

    @GetMapping(value = "listAll")
    public List<OderVO> listAll(){
        return oderWebService.listAllOder();
    }
}
